package com.helwen.constant;

import org.apache.commons.lang3.StringUtils;

import java.util.Objects;



/**
 * @author xay
 * @version 1.0
 * @since 2020/11/5
 */
public interface Constants {

    String RESULT_CODE = "code";
    String RESULT_DATA = "data";
    String RESULT_MSG = "message";


    String FORM_TOKEN = "form_token";


    /**
     * 是
     * */
    Integer YES = 1;
    /**
     * 否
     * */
    Integer NO = 0;

    /**
     * 用户类型
     * 人员类型0.系统管理人员，1.店长，2.二级仓管理员，3.营运者,4.业务员,5客服,6城市管理员,7物流中心,8大车9小车
     * */
    String USER_TYPE_SYS = "0";
    String USER_TYPE_STORE_OWNER = "1";
    String USER_TYPE_SALESMAN_M = "2";
    String USER_TYPE_OPERATOR = "3";
    String USER_TYPE_SALESMAN = "4";
    String USER_TYPE_WAITER = "5";
    String USER_TYPE_CITY_M = "6";
    String USER_TYPE_LG_M = "7";
    String USER_TYPE_DRIVER_D = "8";
    String USER_TYPE_DRIVER_X = "9";

    static boolean isSalesman(String userType){
        return Objects.equals(userType, USER_TYPE_SALESMAN)||Objects.equals(userType, USER_TYPE_SALESMAN_M);
    }

    static boolean isPlatform(String userType){
        return Objects.equals(userType, USER_TYPE_SYS)||Objects.equals(userType,USER_TYPE_CITY_M)||Objects.equals(userType,USER_TYPE_OPERATOR);
    }
    static boolean canLoginAdmin(String userType){
        return StringUtils.equalsAny(userType, USER_TYPE_SYS,USER_TYPE_SALESMAN_M,USER_TYPE_OPERATOR,USER_TYPE_SALESMAN,USER_TYPE_WAITER,USER_TYPE_CITY_M);
    }
    static boolean canLoginStore(String userType){
        return StringUtils.equalsAny(userType, USER_TYPE_STORE_OWNER);
    }
    static boolean canLoginSalesman(String userType){
        return StringUtils.equalsAny(userType, USER_TYPE_SALESMAN_M, USER_TYPE_SALESMAN);
    }
    static boolean canLoginLogistics(String userType){
        return StringUtils.equalsAny(userType, USER_TYPE_LG_M, USER_TYPE_DRIVER_D,USER_TYPE_DRIVER_X)||canLoginSalesman(userType);
    }

    /**
     * 短信模板
     * */
    String SMS_CAPTCHA ="152105";

    static String getSmsCaptchaContent(String code){
        return "#code#="+code;
    }


    /**
     * 店铺状态
     * */
    //正常
    Integer STORE_STATUS_NORMAL = 1;

    /**
     * 流水账户类型
     *0 店铺账户, 1支付宝,2 微信,3 银行卡,4 平台
     * */
    Integer FLOW_ACCOUNT_STORE =0;
    Integer FLOW_ACCOUNT_ALI=1;
    Integer FLOW_ACCOUNT_WX=2;
    Integer FLOW_ACCOUNT_BANK=3;
    Integer FLOW_ACCOUNT_SYS=4;

    /**
     * 流水类型 0 充值, 1 提现, 2 订单付款, 3.订单详情付款 4 订单详情退款(报损),5 订单详情退款(取消订单)
     * */
    Integer FLOW_TYPE_RECHARGE = 0;
    Integer FLOW_TYPE_WITHDRAWAL = 1;
    Integer FLOW_TYPE_ORDER = 2;
    Integer FLOW_TYPE_ORDER_DETAIL = 3;
    Integer FLOW_TYPE_OD_LOSS = 4;
    Integer FLOW_TYPE_OD_CANCEL = 5;

    /**
     * 支付结果
     * 0 未完成 1 完成
     * */
    Integer PAY_UN_COMPLETE = 0;
    Integer PAY_COMPLETE = 1;

    /***
     * PAY_STATE
     *
     * */
    /**
     * 支付完成
     * */
    String PAY_STATE_COMPLETED= "-1";
    /**
     * 已经支付
     * */
    String PAY_STATE_PAID= "-2";

    static String getPayMsg(String payParams) {
        switch (payParams){
            case PAY_STATE_COMPLETED:
                return "余额支付成功.";
            case PAY_STATE_PAID:
                return "订单无法支付";
            default:
                return "";
        }
    }


    /**
     * 编号前缀
     * */
    /**
     * 二级仓送货单
     * */
    String NO_PREFIX_DELIVERY= "WD";
    /**
     *  订单详情
     * */
    String NO_PREFIX_ORDER_DETAIL= "OD";
    /**
     *  店铺账户
     * */
    String NO_PREFIX_STORE_ACCOUNT= "SA";
    /**
     * 二级仓送货单
     * */
    String NO_PREFIX_DEMAND= "WGD";
    /**
     * 二级仓发货单
     * */
    String NO_PREFIX_IN= "IN";
    /**
     * 大车司机任务
     * */
    String NO_PREFIX_TD= "TD";

    /**
     * 送货单状态 0 新建 1 配送中 2 已完成 3 拒收 4 已配货
     * */
    Integer DELIVERY_STATE_NEW = 0;
    Integer DELIVERY_STATE_DELIVERY = 1;
    Integer DELIVERY_STATE_COMPLETE = 2;
    Integer DELIVERY_STATE_REJECTION = 3;
    Integer DELIVERY_STATE_DISTRIBUTION = 4;

    /**
     * 库存变更类型
     * */
    //收货
    Integer INVENTORY_RECEIVED=0;
    //店铺配送
    Integer INVENTORY_OUT_STORE=1;
    //库存调整
    Integer INVENTORY_ADJUST =2;

    /**
     * 物流中心库存变更类型
     * 0 大车收货 1 自提 2 小车装车 3 小车回库 4 手动调整
     * */
    //大车送货
    Integer LOGINVENTORY_DC_S = 0;
    //二级仓自提
    Integer LOGINVENTORY_W_O=1;
    //小车装车
    Integer LOGINVENTORY_XC_O = 2;
    //小车回库
    Integer LOGINVENTORY_XC_I = 3;
    //手动调整
    Integer LOGINVENTORY_ADJUST = 4;



    /**
     * 要货单状态
     *  0 未确认,1 已确认,2 已完成,3 取消
     * */
    //未确认
    Integer DEMAND_NEW = 0;
    //已确认
    Integer DEMAND_DELIVERY = 1;
    //已完成
    Integer DEMAND_RECEIVED = 2;
    //取消
    Integer DEMAND_CANCEL = 3;

    /**
     *  发货单状态 0 待发货 1 送货中 2 已完成
     * */
    Integer INVOICE_NEW = 0;
    Integer INVOICE_DELIVERY = 1;
    Integer INVOICE_RECEIVED = 2;

    /**
     * 任务状态 0 新建 1 进行中 2 已完成 3 申请反库
     * */
    Integer TASK_NEW=0;
    Integer TASK_PROCESSING = 1;
    Integer TASK_COMPLETE = 2;
    Integer TASK_RETURN = 3;


    /**
     * 交货方式 0 送货 1 自提
     * */
    Integer DELIVERY_TYPE_D =0;
    Integer DELIVERY_TYPE_P =1;
}
